package com.h117121.fashionshop.core.service;

import java.util.List;

import com.h117121.fashionshop.core.dom.Account;
import com.h117121.fashionshop.core.dom.Invoice.PaymentMethod;
import com.h117121.fashionshop.core.dom.Producer;
import com.h117121.fashionshop.core.dom.Product;
import com.h117121.fashionshop.core.dom.ProductQuery;
import com.h117121.fashionshop.core.dom.ProductType;
import com.h117121.fashionshop.core.dom.ResultPage;
import com.h117121.fashionshop.core.exception.AccountNotFoundException;
import com.h117121.fashionshop.core.exception.BannedAccountException;
import com.h117121.fashionshop.core.exception.CartEmptyException;
import com.h117121.fashionshop.core.exception.EntityNotFoundException;
import com.h117121.fashionshop.core.exception.SoldOutProductException;
import com.h117121.fashionshop.core.exception.UsernameExistException;
import com.h117121.fashionshop.core.exception.WrongPasswordException;

public interface BusinessService {
	Product getProduct(long id) throws EntityNotFoundException;

	Producer getProducer(long id) throws EntityNotFoundException;

	ProductType getProductType(long id) throws EntityNotFoundException;

	Account getAccount(long id) throws EntityNotFoundException;

	ResultPage findProductByKeyword(String keyword, int index, int numItems);

	ResultPage findByProductQuery(ProductQuery query, int index, int numItems);

	List<Producer> getAllProducer();

	List<ProductType> getAllProductType();

	ResultPage getAllProduct(int index, int numItems);

	ResultPage getAllProducer(int index, int numItems);

	ResultPage getAllProductType(int index, int numItems);

	ResultPage getMostSoldProducts(int index, int numItems);

	ResultPage getNewestProducts(int index, int numItems);

	ResultPage getSimilarProducts(long id, int index, int numItems);

	List<Product> getRandomProducts(int numItems);

	Account authenticate(String username, String password)
			throws AccountNotFoundException, WrongPasswordException,
			BannedAccountException;

	void register(Account account) throws UsernameExistException;

	void checkoutCart(Account account, PaymentMethod paymentMethod)
			throws CartEmptyException, SoldOutProductException;

	void raiseView(Product product);

	void updateProduct(Product product) throws EntityNotFoundException;

	void updateProducer(Producer producer);

	void updateProductType(ProductType productType);

	void deleteProduct(Product product);

	void deleteProducer(Producer producer);

	void deleteProductType(ProductType productType);

	ResultPage findProduct(String keyword, int index, int numItems);

	ResultPage findProducer(String keyword, int index, int numItems);

	ResultPage findProductType(String keyword, int index, int numItems);

	ResultPage findAccount(String keyword, int index, int numItems);

	Account updateAccount(Account account) throws EntityNotFoundException;

	Account updateAccountAdmin(Account account) throws EntityNotFoundException;

	void deleteAccount(Account account);

	void banAccount(Account account);

	void unbanAccount(Account account);

	ResultPage getAllAccount(int index, int numItems);

	Account findByUsername(String username) throws AccountNotFoundException;
}
